package com.example.yjhero.safeapp.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.example.yjhero.safeapp.R;

public class Enterpswdialog extends Dialog implements View.OnClickListener{
    private TextView mTitleTV;
    private EditText mEnterED;
    private  MyCallBack mMyCallBack;

    public Enterpswdialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.dialog_enter_password);
        super.onCreate(savedInstanceState);
        initview();
    }

    public String getmEnterED() {
        return mEnterED.getText().toString().trim();
    }

    public void setmMyCallBack(MyCallBack CallBack) {
        this.mMyCallBack = CallBack;
    }

    private void initview() {
        mTitleTV=findViewById(R.id.tv_enterpwd_title);
        mEnterED=findViewById(R.id.et_enterpwd);
        findViewById(R.id.btn_ok).setOnClickListener(this);
        findViewById(R.id.btn_cancle).setOnClickListener(this);
    }
    
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_ok:
                mMyCallBack.ok();
                break;
            case R.id.btn_cancle:
                mMyCallBack.cancel();
                break;
        }
    }
/**
 * 定义接口以及方法
 * */
    public interface MyCallBack{
        void ok();
        void cancel();
    }
}
